#试做题:1块钱1瓶水，2个瓶盖换一瓶水，用程序实现输入钱数，得到水的个数
m = int(input("零钱数"))

count = m
n = count
while n >=2:
    s = n // 2
    count += s
    n = s + n%2
print(count)